<?php
/**
	* URLHelper using for fast generate URL by templates
**/
class SettingsManager extends CApplicationComponent
{
	protected $settings = array();
	public function init() {
		//init settings from db
	}
	public function getVal($key) {
		if (isset($this->settings[$key])) 	
			return $this->settings[$key]['value'];
		else {
			Yii::log('Requested undefined SettingParameter: '.$key, 'error');
			return false;
		}
	}
	
	public function add($key, $val, $type = 'str', $label = '', $values='') {
		if (!$this->getVal($key)) {
			//adding settings to database
			$this->settings[$key] = Array(
											'value'=> $val,
											'type'=>$type,
											'label'=>$label,
											'vals'=>$values,
											);
			define($key,$val);
		}
		return $this->getVal($key);
	}
	
}